pkgname=poppler-qt5
pkgdesc="Poppler Qt5 bindings"
pkgver=0.57.0
pkgrel=2
arch="all"
license="GPL"
depends="poppler"
makedepends="libjpeg-turbo-dev cairo-dev libxml2-dev
			fontconfig-dev lcms2-dev gobject-introspection-dev
			openjpeg-dev qt5-qtbase-dev poppler-dev cairo-dev glib-dev"
url="https://poppler.freedesktop.org/"
source="https://poppler.freedesktop.org/poppler-${pkgver}.tar.xz"

build() {
	cd "$srcdir"/${pkgname/-qt5/}-${pkgver}
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--disable-static \
		--enable-cairo-output \
		--enable-xpdf-headers \
		--enable-libjpeg \
		--enable-zlib \
		--enable-poppler-glib \
		--disable-poppler-qt4 \
		--enable-poppler-qt5

	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' libtool

	make
}

package() {
	cd "$srcdir/${pkgname/-qt5/}-${pkgver}"
	make -C poppler DESTDIR="${pkgdir}" install-libLTLIBRARIES
	make -C qt5 DESTDIR="${pkgdir}" install
	install -m755 -d "${pkgdir}/usr/lib/pkgconfig"
	install -m644 poppler-qt5.pc "${pkgdir}/usr/lib/pkgconfig/"
	rm -f "${pkgdir}"/usr/lib/libpoppler.*
}
sha512sums="197a0bf51e7fd607db83144d771904e48f266ab9e1252c688f9e7700a5bdd239670cf0363e9d77137bafa9c08fb6ddb9d066cc78a74dac7dfd717662b25cac5f  poppler-0.57.0.tar.xz"
